<html>
<head>
<title>Stickers</title>
</head>

<body>
<center>
<h1>BOI 2000 Day 2 Problem 2</h1>
<h1>Stickers</h1>
</center>

<p>
Charles is an auto races fan and he has decided to make his own model's collection. In the shop it
is possible to buy models in closed and covered boxes. In each box there are parts for one model
and a set of stickers with images of digits. In every box the set of stickers is the same. Charles
decided to label models by consecutive integers starting from 1. For example, to label the 2070-th
model four stickers are necessary: one sticker with ''2'', two with ''0'' and one with ''7''.
<p>
Charles completes every model in the following way: he opens a new box, builds the model and labels
it using sticker(s). He can use stickers from current and previously opened boxes, but it is not
allowed to open an additional new box to get at missing stickers.
<p>
Write a program which for a given set of stickers counts how many models Charles can label in the described way.

<h2>Input</h2>
In the only line of text file STI.IN ten one-digit integers<br>
<center>
<p>
i<sub>0</sub>, i<sub>1</sub>, i<sub>2</sub>, i<sub>3</sub>, i<sub>4</sub>, i<sub>5</sub>, i<sub>6</sub>, i<sub>7</sub>, i<sub>8</sub>, i<sub>9</sub>
</center>
<p>
are given, where i<sub>j</sub> is the number of stickers with digit j, (0&lt;= j &lt;= 9) in the sticker set of every box. Each two neighbour digits are separated by one space symbol.

<h2>Output</h2>
The only line of text file STI.OUT should contain one integer -- number of labeled models.

<h2>Sample Input 1</h2>
<pre>
1 1 1 1 1 1 1 1 1 1
</pre>

<h2>Sample Output 1</h2>
<pre>
199990
</pre>

<h2>Sample Input 2</h2>
<pre>
3 4 5 4 3 4 5 4 3 4
</pre>

<h2>Sample Output 2</h2>
<pre>
49999999499999999949999999973
</pre>

<h2>Remark</h2>
Time limit for each test: 20 s<br>

</body>
</html>
